<?php

namespace Module\AigcChatZhipuAi\Admin\Controller;

use Illuminate\Routing\Controller;
use ModStart\Admin\Layout\AdminConfigBuilder;
use Module\AigcChatZhipuAi\Type\ApiMode;

class ConfigController extends Controller
{
    public function index(AdminConfigBuilder $builder)
    {
        $builder->pageTitle('智谱AI对话模型驱动');
        $builder->select('AiChatZhipuAi_Model', '模型')
            ->options([
                'chatglm_std' => 'ChatGLM-Std',
                'chatglm_lite' => 'ChatGLM-Lite',
            ])
            ->defaultValue('chatglm_std');
        $builder->complexFields('AiChatZhipuAi_Param', '模型参数')
            ->fields([
                // ['name' => 'context_num', 'title' => '上下文总数', 'type' => 'slider', 'defaultValue' => 3, 'min' => 1, 'max' => 5, 'step' => 1, 'tip' => '生成文本的最大长度，取值范围为1~5之间的整数',],
                // ['name' => 'n', 'title' => '最大回复', 'type' => 'slider', 'defaultValue' => 1, 'min' => 1, 'max' => 5, 'step' => 1, 'tip' => '为每个输入消息生成多少个聊天完成选项，取值范围为1~5之间的整数',],
                ['name' => 'temperature', 'title' => '词汇属性', 'type' => 'slider', 'defaultValue' => 0.8, 'min' => 0, 'max' => 2, 'step' => 0.1, 'tip' => '用于控制生成文本的随机性，取值范围为0~1之间的浮点数，建议取值0.7左右',],
                // ['name' => 'top_p', 'title' => '随机属性', 'type' => 'slider', 'defaultValue' => 1, 'min' => 0, 'max' => 1, 'step' => 0.1, 'tip' => '用于控制生成文本的多样性，取值范围为0~1之间的浮点数，建议取值0.9左右',],
                // ['name' => 'presence_penalty', 'title' => '话题属性', 'type' => 'slider', 'defaultValue' => 0, 'min' => -2.0, 'max' => 2.0, 'step' => 0.1, 'tip' => '用于控制生成文本中是否出现给定的关键词，取值范围为-2.0~2.0之间的浮点数，建议取值0.5左右',],
                // ['name' => 'frequency_penalty', 'title' => '重复属性', 'type' => 'slider', 'defaultValue' => 0, 'min' => -2.0, 'max' => 2.0, 'step' => 0.1, 'tip' => '用于控制生成文本中重复的程度，取值范围为-2.0~2.0之间的浮点数，建议取值0.5左右',],
            ]);
        $builder->formClass('wide');
        return $builder->perform();
    }

}
